/* GUI CONVERTED from rcrsdupa.p (converter v1.76) Fri May  3 13:21:58 2002 */
/* rcrsdupa.p - Customer Schedules : Copy Line to remote database       */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                  */
/* All rights reserved worldwide.  This is an unpublished work.         */
/* $Revision: 1.4.1.3 $                                                     */
/*V8:ConvertMode=Maintenance                                            */
/* REVISION: 7.3    LAST MODIFIED: 08/13/93           BY: WUG *GE19*    */
/* REVISION: 7.3    LAST MODIFIED: 08/02/95           BY: bcm *G0TB*    */
/* REVISION: 8.6    LAST MODIFIED: 05/20/98           BY: *K1Q4* Alfred Tan   */
/* REVISION: 8.6E   LAST MODIFIED: 01/20/00           BY: *J3NH* Ashwini G    */
/* REVISION: 9.1    LAST MODIFIED: 08/12/00           BY: *N0KP* myb        */
/* Old ECO marker removed, but no ECO header exists *F0PN*                    */
/* $Revision: 1.4.1.3 $    BY: Katie Hilbert         DATE: 04/22/02  ECO: *P03J*  */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

/* UPDATE REMOTE DATABASE SO DETAIL RECORD */

/* REPLACED NULLSTREAM BY BUFFER-COPY STATEMENT */

define shared workfile work_sod_det no-undo like sod_det.

do for sod_det:
   find first work_sod_det no-lock no-error.
   if available work_sod_det
   then do:
      for first so_mstr
         field (so_nbr so_ship)
         where so_nbr = work_sod_det.sod_nbr no-lock:
      end. /* FOR FIRST SO_MSTR */

      find sod_det
         where sod_det.sod_nbr  = work_sod_det.sod_nbr
           and sod_det.sod_line = work_sod_det.sod_line
      exclusive-lock no-error.

      if not available sod_det then create sod_det.

      buffer-copy work_sod_det to sod_det.

      if not can-find(scx_ref where scx_type  = 1
         and scx_order = sod_nbr
         and scx_line  = sod_line)
      then do:
         create scx_ref.

         /* WE NEED TO USE THE sod_det INFORMATION SINCE THE HEADER
            SITE REPRESENTS THE AR SITE IN CUSTOMER SCHEDULES */
         assign
            scx_type       = 1
            scx_shipfrom   = sod_site
            scx_shipto     = so_ship
            scx_part       = sod_part
            scx_custref    = sod_custref
            scx_po         = sod_contr_id
            scx_modelyr    = sod_modelyr
            scx_order      = so_nbr
            scx_line       = sod_line.
      end. /*IF NOT CAN FIND */
   end. /* IF AVAILABLE WORK_SOD_DET */

end. /* DO FOR SOD_DET */
